﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Net;
using System.IO;
using System.Web.Services;


namespace AlisV6Soap
{
    public class CAlisV6Soap
    {
        public string sUrl;

        public CAlisV6Soap(string url)
        {
            sUrl = url;            
        }

        public string SendAndGetMessage(string sIn)
        {
            string sOut="";
            try
            {
                // http://www.andromeda.fis-eu.biz/AlisWebServices-rs/services/AlisWebService
                AlisWebService alisws = new AlisWebService();
                alisws.Url = sUrl + ".AlisWebServiceHttpSoap11Endpoint/";
                sOut = alisws.putAndGetMessage(sIn);
            }
            catch(Exception ex) 
            {
                sOut= @"<Root>
    <ReturnCode>2</ReturnCode>
    <Reason>
        <Message><![CDATA[$Error$]]></Message>
        <Code>-1</Code>
    </Reason>
</Root>
";
                sOut = sOut.Replace("$Error$", ex.Message);
            }
            return sOut;
        }
    }
}
